<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./echarts.js"></script>
</head>

<body>
    <div style="width: 100%;height:800px" id="main"></div>
</body>

</html>
<script>
    let main = document.querySelector('#main')
    let obj = echarts.init(main)
    let option = {
        // 提示
        tooltip: {
            trigger: 'item',
            triggerOn: 'mousemove'
        },
        series: [
            {
                // 树形图
                type: 'tree',
                data: [
                    {
                        name: '根节点',
                        children: [
                            {
                                name: '层级2',
                                children: [
                                    {
                                        name: '层级3-1',
                                        children: [
                                            {
                                                name: '数据1',
                                                value: 2345
                                            },
                                            {
                                                name: '数据2',
                                                value: 3212
                                            },
                                            {
                                                name: '数据3',
                                                value: 2464
                                            },
                                            {
                                                name: '数据4',
                                                value: 2467
                                            },

                                        ]
                                    },
                                    {
                                        name: '层级3-1',
                                        children: [
                                            {
                                                name: '数据1',
                                                value: 2345
                                            },
                                            {
                                                name: '数据2',
                                                value: 3212
                                            },
                                            {
                                                name: '数据3',
                                                value: 2464
                                            },
                                            {
                                                name: '数据4',
                                                value: 2467
                                            },

                                        ]
                                    },
                                ]
                            }
                        ]
                    }

                ],




            }
        ]
    }
    obj.setOption(option)
</script>